-
Notifications
You must be signed in to change notification settings - Fork 9
Feat: Add query optimization for vector search with configurable models #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add SLOW_MODEL and FAST_MODEL config settings with OpenAI defaults - Create optimize_query_for_vector_search() function using FAST_MODEL - Add optimize_query parameter to search functions (default True for API, False for MCP/tools) - Update all docstrings to refer to "query for vector search" terminology - Comprehensive test coverage with 27+ specific tests for query optimization - Robust error handling with graceful fallbacks when optimization fails 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request implements query optimization for vector search using configurable AI models to improve search performance. The feature adds smart query rewriting to make natural language queries more effective for semantic similarity search while preserving original intent.
- Adds configurable SLOW_MODEL and FAST_MODEL settings with OpenAI defaults
- Implements query optimization with selective defaults (enabled for API, disabled for MCP/tools)
- Provides comprehensive error handling with graceful fallbacks when optimization fails
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
agent_memory_server/config.py | Adds slow_model and fast_model configuration settings with OpenAI defaults |
agent_memory_server/llms.py | Implements optimize_query_for_vector_search function using fast model with error handling |
agent_memory_server/long_term_memory.py | Integrates query optimization into search_long_term_memories with configurable toggle |
agent_memory_server/api.py | Updates API endpoints to support optimize_query parameter with True default |
agent_memory_server/mcp.py | Updates MCP functions with optimize_query parameter defaulting to False for LLM tools |
agent-memory-client/agent_memory_client/client.py | Updates client methods to support optimize_query parameter with appropriate defaults |
tests/ | Comprehensive test coverage for query optimization functionality and error scenarios |
- Extract hardcoded optimization prompt to config.py setting - Add min_optimized_query_length config setting - Fix AttributeError handling for missing response.choices - Fix malformed test by properly checking hasattr before deletion - Extract magic number to class constant 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Minor version bump for new optimize_query parameter feature added to search and memory prompt methods. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
🤖 Generated with Claude Code